const add = (a, b, c, d, e) => {
  return a + b + c + d + e
}

const curry = (fn, arr = []) => {
  let len = fn.length; // 获取参数长度
  return (...args) => {
    arr = arr.concat(args);
    if(arr.length < len) return curry(fn, arr);
    return fn(...arr)
  }
}

const b = curry(add)(1)(2,3,4)(5)
console.log(b)
